/**********************************************************************************
// Vector Header File
// 
// Creation:	19 Set 2008
// Updated:		27 Set 2009
// Compiler:	Visual Studio 2008
//
// Notes:		Define vector arithmetics
//
**********************************************************************************/

#ifndef _ANABELE_VECTOR_H_
#define _ANABELE_VECTOR_H_

// make classes and functions exportable to a DLL
#ifdef ANABELE_EXPORTS
#define DLL __declspec( dllexport ) 
#else
#define DLL __declspec( dllimport )
#endif
 

/**********************************************************************************/

#include <cmath>

/**********************************************************************************/

class DLL Vector2
{
private:
	static const double PI;
	float angle;											// vector's angle with horizontal
	float magnitude;										// vector's magnitude

public:
	Vector2();												// default constructor
	Vector2(float ang, float mag);							// constructor

	void  SetVector(float ang, float mag);					// set vector's angle and magnitude
	void  SetMagnitude(float mag) { magnitude = mag; }		// set vector's magnitude
	void  SetAngle(float ang) { angle = ang; }				// set vector's angle
	void  Rotate(float theta);								// rotate vector by the given angle
	float Ang() const { return angle; }						// return vectors's angle
	float Mag() const { return magnitude; }					// return vector's magnitude
	float GetX() const { return magnitude * cos(Rad()); }	// return X component of vector
	float GetY() const { return magnitude * sin(Rad()); }	// return Y component of vector
	float Rad() const { return float(angle * PI / 180.0); }	// convert angles to radians
	void  Add(const Vector2 &v);							// add given vector to this vector
}; 

/**********************************************************************************/

#endif